 {include file="public/head" /}
 <meta charset="utf-8">
<body>
	<nav class="breadcrumb">
		<span class="breadcrumb-item">代理财务</span> <span
			class="breadcrumb-item">提币记录</span>
	</nav>
	<div id="box" v-cloak>
		<div class="info-title">账户信息</div>
		<div>
			<div class="form-group input-group-sm">
				<label>我的保证金</label>
				<div>{{account.bail}}</div>
			</div>
			<div class="form-group input-group-sm">
				<label>我的可以提余额</label>
				<div>{{account.bail - param.min_bai_num}}</div>
			</div>
			<div class="form-group input-group-sm">
				<label>提币金额（扣除手续费：{{param.cash_fee}}）</label>
				<input type="number" class="form-control" placeholder="请输入提币金额" v-model="price" required="required">
			</div>
			<div class="form-group input-group-sm">
				<label>提币地址</label>
				<input type="text" class="form-control" placeholder="请输入提币地址" v-model="address" required="required">
			</div>
			<div class="form-group input-group-sm">
				<button class="btn btn-primary btn-sm" @click="cash()">立即提币</button>
			</div>
		</div>
		<div class="info-title">提币列表</div>
		<table class="table table-sm table-bordered">
			<tr>
				<th width="50px">#</th>
				<th>提现金额</th>
				<th>手续费</th>
				<th>实到金额</th>
				<th>提币地址</th>
				<th>提币状态</th>
				<th>提币时间</th>
				<th>审核时间</th>
			</tr>
			<template v-for="(item,key) in list.data">
				<tr>
					<td widtd="50px">{{key + 1}}</td>
					<td>{{item.price}}</td>
					<td>{{item.fee}}</td>
					<td>{{item.real_price}}</td>
					<td>{{item.address}}</td>
					<td>
						<span v-if="item.state == 0" class="badge badge-primary">审核中</span>
						<span v-if="item.state == 1" class="badge badge-success">已同意</span>
						<span v-if="item.state == 2" class="badge badge-danger">已拒绝</span>
					</td>
					<td>{{item.create_time}}</td>
					<td>{{item.update_time}}</td>
				</tr>
			</template>
			<tr v-else>
				<td colspan="9" class="no-table">暂无数据</td>
			</tr>
		</table>
	</div>
</body>
<script>
new Vue({
	el:"#box",
	data:{
		account : {$account | json_encode},
		param : {$param | json_encode},
		price : '',
		address : '',
		list : {$list | json_encode}
	},
	mounted:function(){},
	methods:{
		cash:function(){
			console.log('账户：'+this.account.bail);
			console.log('最低金额：'+this.param.min_bai_num);
			console.log('账户小于最低金额：'+ (this.account.bail < this.param.min_bai_num));
			if(parseFloat(this.account.bail) < parseFloat(this.param.min_bai_num)) return layer.msg('不可提现',{icon:2,time:1000});
			if(!this.price)return layer.msg('请输入提币金额',{icon:2,time:1000});
			if(!this.address)return layer.msg('请输入提币地址',{icon:2,time:1000});
			if(this.price > (this.account.bail - this.param.min_bai_num))return layer.msg('账户余额不足',{icon:2,time:1000});
			ajax("{:url('cashDao')}",{
				data:{price : this.price , address : this.address},
				success:function(res){
					if(res.code) {
						layer.msg(res.msg,{icon:1,time:1000},function(){
							location.reload();
						});
					}else{
						layer.msg(res.msg,{icon:2,time:1000});
					}
				}
			});
		}
	}
});
</script>
</html>